/**
 * 
 */
package hihocoder;

import java.util.HashSet;
import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class 缺失的拼图 {

	static class Point{
		int x;
		int y;
		public Point(int x,int y) {
			this.x=x;
			this.y=y;
		}
	    @Override
	    public int hashCode() {
	        return String.valueOf(x+""+y).hashCode();
	    }
		@Override
		public boolean equals(Object obj) {
			Point otherPoint=(Point)obj;
//			System.out.println("比較 x"+this.x+" "+otherPoint.x);
//			System.out.println("比較 y "+this.y+" "+otherPoint.y);
//			System.out.println("result:"+(this.x==otherPoint.x&&this.y==otherPoint.y));
			return this.x==otherPoint.x&&this.y==otherPoint.y;
		}
		
		@Override
		public String toString() {
			return "X "+this.x+" Y "+this.y;
		}
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int n=scanner.nextInt();
		HashSet<Point> allPoints=new HashSet<>();
		for (int i = 0; i < n; i++) {
			int x1=scanner.nextInt();
			int y1=scanner.nextInt();
			int x2=scanner.nextInt();
			int y2=scanner.nextInt();
			Point[] points=new Point[4];
			points[0]=new Point(x1, y1);
			points[1]=new Point(x1, y2);
			points[2]=new Point(x2, y1);
			points[3]=new Point(x2, y2);
			for (int j = 0; j < 4; j++) {
				if(allPoints.contains(points[j])){
//					System.out.println("行動后result:true remove "+points[j]);
					allPoints.remove(points[j]);
				}else {
//					System.out.println("行動后result:false add "+points[j]);
					allPoints.add(points[j]);
				}
//				System.out.println(allPoints);
			}
		}
//		System.out.println(allPoints);
//		System.out.println(allPoints.size());
		Point[] points=new Point[4];
		int i=0;
		for (Point point : allPoints) {
			points[i]=point;
			i++;
		}
		//取出左上角和右下角
		int x[]=new int[2];
		int y[]=new int[2];
		boolean start=true;
		for (Point point : points) {
			int curX=point.x;
			int curY=point.y;
			if(start){
				x[0]=curX;
			}else if (curX!=x[0]) {
				x[1]=curX;
			}
			if(start){
				y[0]=curY;
				start=false;
			}else if (curY!=y[0]) {
				y[1]=curY;
			}
		}
		if(x[0]>x[1]){
			int tmp=x[0];
			x[0]=x[1];
			x[1]=tmp;
		}
		if(y[0]>y[1]){
			int tmp=y[0];
			y[0]=y[1];
			y[1]=tmp;
		}
		System.out.println(x[0]+" "+y[0]+" "+x[1]+" "+y[1]);
	}

}
